import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

// 引入element
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
// 引入树状图
import TreeTable from 'vue-table-with-tree-grid'
//全局注册组件
Vue.component('tree-table', TreeTable)

// 引入vant
import Vant from 'vant';
import 'vant/lib/index.css';
Vue.use(Vant);

// 引入axios
import axios from 'axios'
Vue.prototype.$axios = axios

// 引入矢量图
import '@/assets/fonts/iconfont.css'
// 引入富文本编辑器

import VueQuillEditor from 'vue-quill-editor'

// require styles
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

Vue.use(VueQuillEditor, /* { default global options } */)

axios.defaults.baseURL = "https://www.liulongbin.top:8888/api/private/v1/"
axios.defaults.method = 5000

  // 在请求头中加token
// axios.interceptors.request.use(config => {

//   // console.log(config)

//   // let a = sessionStorage.getItem('token')

//   // console.log(a)

//   // config.headers.Authorization = a

//   // config.headers['token'] = a


//   return config

// })
axios.interceptors.request.use(config => {
  let token = sessionStorage.getItem("token")
  config.headers.Authorization = token
  return config
})
Vue.config.productionTip = false
Vue.filter("dateFormat", function (origimVai) {
 const dt= new Date(origimVai)
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, "0")
  const d = (dt.getDate() + '').padStart(2, "0")
  
  const hh = (dt.getHours() + '').padStart(2, "0")
  const mm = (dt.getMinutes() + '').padStart(2, "0")
  const ss = (dt.getSeconds() + '').padStart(2, "0")
  
  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
